home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gdevhit.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.8 KB  |  93 lines

  1. /* Copyright (C) 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gdevhit.c,v 1.2 2000/09/19 19:00:13 lpd Exp $ */
  20. /* Hit detection device */
  21. #include "std.h"
  22. #include "gserror.h"
  23. #include "gserrors.h"
  24. #include "gstypes.h"
  25. #include "gsmemory.h"
  26. #include "gxdevice.h"
  27.  
  28. /* Define the value returned for a detected hit. */
  29. const int gs_hit_detected = gs_error_hit_detected;
  30.  
  31. /*
  32.  * Define a minimal device for insideness testing.
  33.  * It returns e_hit whenever it is asked to actually paint any pixels.
  34.  */
  35. private dev_proc_fill_rectangle(hit_fill_rectangle);
  36. const gx_device gs_hit_device = {
  37.  std_device_std_body(gx_device, 0, "hit detector",
  38.              0, 0, 1, 1),
  39.  {NULL,                /* open_device */
  40.   NULL,                /* get_initial_matrix */
  41.   NULL,                /* sync_output */
  42.   NULL,                /* output_page */
  43.   NULL,                /* close_device */
  44.   gx_default_map_rgb_color,
  45.   gx_default_map_color_rgb,
  46.   hit_fill_rectangle,
  47.   NULL,                /* tile_rectangle */
  48.   NULL,                /* copy_mono */
  49.   NULL,                /* copy_color */
  50.   gx_default_draw_line,
  51.   NULL,                /* get_bits */
  52.   NULL,                /* get_params */
  53.   NULL,                /* put_params */
  54.   gx_default_map_cmyk_color,
  55.   NULL,                /* get_xfont_procs */
  56.   NULL,                /* get_xfont_device */
  57.   gx_default_map_rgb_alpha_color,
  58.   gx_default_get_page_device,
  59.   gx_default_get_alpha_bits,
  60.   NULL,                /* copy_alpha */
  61.   gx_default_get_band,
  62.   NULL,                /* copy_rop */
  63.   gx_default_fill_path,
  64.   NULL,                /* stroke_path */
  65.   NULL,                /* fill_mask */
  66.   gx_default_fill_trapezoid,
  67.   gx_default_fill_parallelogram,
  68.   gx_default_fill_triangle,
  69.   gx_default_draw_thin_line,
  70.   gx_default_begin_image,
  71.   gx_default_image_data,
  72.   gx_default_end_image,
  73.   gx_default_strip_tile_rectangle,
  74.   gx_default_strip_copy_rop,
  75.   gx_get_largest_clipping_box,
  76.   gx_default_begin_typed_image,
  77.   NULL,                /* get_bits_rectangle */
  78.   gx_default_map_color_rgb_alpha,
  79.   gx_non_imaging_create_compositor,
  80.   NULL                /* get_hardware_params */
  81.  }
  82. };
  83.  
  84. /* Test for a hit when filling a rectangle. */
  85. private int
  86. hit_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
  87.            gx_color_index color)
  88. {
  89.     if (w > 0 && h > 0)
  90.     return_error(gs_error_hit_detected);
  91.     return 0;
  92. }
  93.